package com.kc.gb.device.plugins.camera.service.impl;

import com.kc.gb.device.common.dto.CameraConfig;
import com.kc.gb.device.common.utils.SpringHelper;
import com.kc.gb.device.plugins.camera.listener.support.CameraPublishEvent;
import com.kc.gb.device.plugins.camera.service.CameraHardwareService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CameraHardwareServiceImpl implements CameraHardwareService {

    @Override
    public void report(CameraConfig config, String message){
        log.info("Camera report:{} message:{}",config,message);
        CameraPublishEvent event = new CameraPublishEvent();
        event.setStation(config.getStation());
        event.setPoint(config.getPoint());
        event.setIp(config.getIp());
        event.setPort(config.getPort());
        event.setMessage(message);
        SpringHelper.getApplicationContext().publishEvent(event);
    }
}
